package org.imj.dao;

import com.google.inject.Inject;
import org.mybatis.guice.transactional.Transactional;

import org.imj.model.State;
import org.imj.data.StateMapper;


public class StateDAOImpl implements StateDAO {

	@Inject
	private StateMapper stateMapper;
	
	@Override
	@Transactional
	public boolean insert(State state) {
		stateMapper.insertState(state);
		return false;
	}

	@Override
	@Transactional
	public boolean update(State state) {
		return false;
	}

	@Override
	@Transactional
	public boolean delete(int id) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	@Transactional //TODO add exception handler
	public State getById(int id) {
		return stateMapper.selectStateById(id);
	}

	@Override
	@Transactional
	public State getByName(String name) {
		return stateMapper.selectStateByName(name);
	}

	@Override
	public State getByCapitalCity(int capitalCityId) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	@Transactional
	public int getMaxId(){
		return stateMapper.selectMaxId();
	}
}
